<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>上传摄像头信息界面</title>

    <link href="https://fonts.googleapis.com/css?family=Raleway:400,700|Roboto:600" rel="stylesheet">
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/css/style.css">
    <link rel="stylesheet" href="/static/css/responsive.css">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="top-bar">
    <div class="container">
        <div class="row">
            <div class="col-md-12 col-sm-9" >
                <a href="http://localhost:6021/index" class="img-circle"><img style="height: 75px;" src="/static/images/logo.jpg" alt=""></a>
                <div class="btn-group col-md-offset-10">
                    <button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown"
                            aria-haspopup="true" aria-expanded="false" th:text="${managerName}">
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="http://localhost:7051/quitManager">注销</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="container-fluid" style="margin: 50px 0 0 0;">
    <div id="leftNav" class="col-md-1">
        <ul class="nav nav-pills nav-stacked">
            <li class="active"><a>消息管理</a></li>
            <!-- 这里的active属性就是使得所在的li的背景色变为蓝色-->
            <li><a href="http://localhost:6001/toMessage">查看预警消息</a></li>
            <li class="active"><a>图片管理</a></li>
            <!-- 这里的active属性就是使得所在的li的背景色变为蓝色-->
            <li><a href="http://localhost:6001/toUserImage">用户上传图片</a></li>
            <li><a href="http://localhost:6001/toCameraImage">摄像头图片</a></li>
            <li class="active"><a>摄像头管理</a></li>
            <!-- 这里的active属性就是使得所在的li的背景色变为蓝色-->
            <li><a href="http://localhost:6001/toCamera">摄像头信息</a></li>
            <li><a href="http://localhost:6001/toUploadCamera">设立摄像信息</a></li>
            <li class="active"><a>城市管理</a></li>
            <!-- 这里的active属性就是使得所在的li的背景色变为蓝色-->
            <li><a href="http://localhost:6001/toPosition">查看城市信息</a></li>
            <li class="active"><a>用户信息管理</a></li>
            <!-- 这里的active属性就是使得所在的li的背景色变为蓝色-->
            <li><a href="http://localhost:6001/toUserList">查看用户信息</a></li>
        </ul>
    </div>
    <div class="col-md-4 col-md-offset-3" style="margin: 100px 0 0 500px; background-color: darkturquoise;border-radius: 25px;">
        <form action="http://localhost:7001/uploadCamera" method="post">
            <div class="input-group" style="margin: 50px 0 0 0;text-align: center;color: white;">
                <h1>设立摄像头</h1>
            </div>
            <div class="input-group" style="margin: 10px 0 0 0;">
                <input type="text" class="form-control" placeholder="摄像头街道地址"
                                            id="cameraName" name="cameraName">
            </div>
            <div class="input-group" style="margin: 10px 0 0 50px;">
                <select  name="province" id="province" onclick="getCity()">
                    <option value="">----请选择省----</option>
                </select>
                <select name="city" id="city" onclick="getDistrict()">
                    <option value="">-----请选择城市-----</option>
                </select>
                <select name="district" id="district">
                    <option value="">-----请选择区/县-----</option>
                </select>
            </div>
            <button class="col-md-offset-5 btn btn-default" style="margin: 10px 0 50px 200px;">上传</button>
        </form>
    </div>
</div>
<footer class="panel-footer" style="width: 100%; overflow: hidden;">
    <div class="container">
        <div class="row footer-top" style="text-align: center;">
            <h1 class="col-md-4 col-md-offset-4">城市防涝检测系统</h1>
        </div>
        <hr style="border: 1px  solid #000000;">
        <div class="row" style="text-align: center;">
            <div class="col-md-6">
                <label>智能生活，一切为你！</label>
                <label>I can do everything for you!</label>
            </div>
            <div class="col-md-6">
                <ul>
                    <li>技术链接</li>
                    <li><a href="https://tensorflow.google.cn" style="color: gray;">tensorflow</a></li>
                    <li><a href="https://spring.io/projects/spring-boot" style=" color: gray;">spring-boot</a></li>
                    <li><a href="http://www.mybatis.cn/" style=" color: gray;">mybatis</a></li>
                    <li><a href="https://flask.palletsprojects.com/en/1.1.x/" style=" color: gray;">flask</a></li>

                </ul>
            </div>
        </div>
    </div>
</footer>
</body>
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/scripts.js"></script>
<script type="text/javascript">
    function getAllProvince() {
        $.ajax({
            url: "http://localhost:7081/getAllProvince",
            type: "GET",
            dataType: "json",
            contentType: "application/json;charset=utf-8",
            success: function (data) {
                if (data != null) {
                    $(data).each(function (i) {
                        $("#province").append(
                            '<option value="' + data[i].provinceId + '">' + data[i].province + '</option>'
                        );
                    });
                }
            },
            error: function () {
                alert("省份请求错误！");
            }
        });

    }

    window.onload = getAllProvince;

    //所在区域联动列
    function getCity() {
        $("#city").html('<option value="">----请选择城市----</option>');
        $.ajax({
            url: "http://localhost:7081/getAllCityByProvince?provinceId=" + $("#province").val(),
            type: "GET",
            dataType: "json",
            success: function (data) {
                if (data != null) {
                    $(data).each(function (i) {
                        $("#city").append(
                            '<option value="' + data[i].cityId + '">' + data[i].city + '</option>'
                        );
                    });
                }
            },
            error: function () {
                alert("请先选择省份！");
            }
        });
    }

    //市级菜单选择事件
    function getDistrict() {
        $("#district").html('<option value="">----请选择区域----</option>');
        $.ajax({
            url: "http://localhost:7011/getAllDistrictByCity?cityId=" + $("#city").val(),
            type: "GET",
            dataType: "json",
            success: function (data) {
                if (data != null) {
                    $(data).each(function (i) {
                        $("#district").append(
                            '<option value="' + data[i].districtId + '">' + data[i].district + '</option>'
                        );
                    });
                }
            },
            error: function () {
                alert("请先选择城市！");
            }
        });
    }
</script>
</html>